﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Effects;

namespace Veralkohol.Converters
{
    class Double2EffectConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            DropShadowEffect eff = new DropShadowEffect();
            eff.BlurRadius = 5;
            eff.ShadowDepth = 5;
            eff.Direction = -45;

            if ((double)value <= 0.03)
            {
                eff.Color = Colors.WhiteSmoke;
            }
            else if ((double)value <= 0.5)
            {
                eff.Color = Colors.LightGreen;
            }
            else if ((double)value <= 1.5)
            {
                eff.Color = Colors.Yellow;
            }
            else if ((double)value <= 2.5)
            {
                eff.Color = Colors.Orange;
            }
            else if ((double)value <= 3.5)
            {
                eff.Color = Colors.Red;
            }
            else if ((double)value <= 4.5)
            {
                eff.Color = Colors.DarkRed;
            }
            else
            {
                eff.Color = Colors.Black;
            }

            return eff;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
